import subprocess


def get_users():
    output = subprocess.run('cat /etc/passwd', shell=True, capture_output=True).stdout.decode().split('\n')
    home_folders = subprocess.run('ls -d /home/*/', shell=True, capture_output=True).stdout.decode().split()
    res = dict()
    for i in range(len(home_folders)):
        home_folders[i] = home_folders[i].split('/')[-2]
    for line in output:
        try:
            temp = line.split(':')
            if temp[0] in home_folders:
                res[temp[0]] = temp[4]
        except IndexError:
            continue
    return res


def current_user():
    return subprocess.run('whoami', shell=True, capture_output=True).stdout.decode()
